import java.util.Scanner;
import java.lang.Math;

public class Bus extends Vehicle
{
    private String vehicleid;
    private String brand;
    private String type;
    private float perRent;
    private double SeatCount;
    @Override
    public float calRent(int day)
    {
        float m;
        if(day<3) m=day*super.getPerRent();
        else if(day<7) m= (float) (0.9*day*getPerRent());
        else if(day<30) m= (float) (0.8*day*getPerRent());
        else if(day<150) m=(float) (0.7*day*getPerRent());
        else m=(float) (0.6*day*getPerRent());
        User.pay=m;
        return m;
    }
    @Override
    public boolean leaseOutFlow()
    {
        System.out.println("请选择你要租赁的客车类型：1.金杯  2.金龙");
        Scanner in = new Scanner(System.in);
        int choice=in.nextInt();
        if(choice==1)
        {
            System.out.println("请选择你要租赁的的客车座位数：");
            int num=in.nextInt();
            String type=num+"座";
            System.out.println("请输入您想要租赁的天数");
            int day=in.nextInt();
            String id="京NY";
            id+=(int)(10000+89999*Math.random());
            setVehicleid(id);
            setBrand("金杯");
            setType("type");
            setPerRent(800);
            System.out.println("分配给您的汽车车牌号是："+getVehicleid());
            System.out.println("您需要支付的租赁费用是："+calRent(day));
            System.out.println(" 请问是否支付 : 1.支付  2.退出");
            int q = in.nextInt();
            if(q==1)
            {
                System.out.println("支付成功");
                return true;
            }
            else
            {
                System.out.println("支付失败");
                return false;
            }
        }

        else
        {
            System.out.println("请选择你要租赁的的客车座位数：");
            int num=in.nextInt();
            String type=num+"座";
            System.out.println("请输入您想要租赁的天数");
            int day=in.nextInt();
            String id="京NY";
            id+=(int)(10000+89999*Math.random());
            setVehicleid(id);
            setBrand("金龙");
            setType(type);
            setPerRent(1500);
            System.out.println("分配给您的汽车车牌号是："+getVehicleid());
            System.out.println("您需要支付的租赁费用是："+calRent(day));
            System.out.println("请问是否支付 1.是 2.否");
            int q= in.nextInt();
            if(q==1)
            {
                System.out.println("支付成功");
                return true;
            }
            else
            {
                System.out.println("支付失败");
                return false;
            }
        }
    }
}
